//
//  BaseParmModel.m
//  IOS7Test
//
//  Created by zhangtie on 13-11-6.
//  Copyright (c) 2013年 zhangtie. All rights reserved.
//

#import "QBBaseParmModel.h"

@interface QBBaseParmModel ()

@property(nonatomic, retain)NSMutableDictionary *parmDict;

@end

@implementation QBBaseParmModel

- (void)dealloc
{
    RELEASE_SAFELY(_parmDict);
    [super dealloc];
}

- (void)setParm:(id)parmVal forKey:(NSString*)parmName
{
    if(nil == parmName)
        return;
    
    SET_PARAM(parmVal, parmName, self.parmDict);
}

- (id)parmValForKey:(NSString*)key
{
    return PUGetElemForKeyFromDict(key, self.parmDict);
}

- (void)setNum:(int)num
{
    QB_SET_RETAIN_INTPARM(num, @"");
}

- (NSDictionary*)parm2jsonObj
{
    return _parmDict;
}

#pragma mark -- getter
- (NSMutableDictionary*)parmDict
{
    if(!_parmDict)
    {
        _parmDict = _ALLOC_OBJ_(NSMutableDictionary);
        
    }
    return _parmDict;
}

//+ (id)parmObj
//{
//    QBBaseParmModel *parm = _ALLOC_OBJ_(QBBaseParmModel);
//    return [parm autorelease];
//}

+ (id)parmObj
{
    return [[[[self class] alloc]init] autorelease];
}


@end
